package com.sdkx.app.model;

import android.support.annotation.NonNull;

/**
 * 求最近距离时候使用
 */
public class DistanceObject implements Comparable<DistanceObject> {
    private int id;
    private double distance;

    public DistanceObject(int id,double distance){
        this.id=id;
        this.distance=distance;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public double getDistance() {
        return distance;
    }

    public void setDistance(double distance) {
        this.distance = distance;
    }

    @Override
    public int compareTo(@NonNull DistanceObject distanceObject) {
        return (int)(this.getDistance() - distanceObject.getDistance());
    }
}
